//#define __DEBUG__
// by Xeno
#define THIS_FILE "fn_linemaker.sqf"
#include "x_setup.sqf"

// draws a marker line between two points
// param1 = position one, param2 = position two, param3 for naming the lines, value gets increased by one and returned 
// markernames are componmentname_aline_param3value
// for dom it's d_aline_1 for example
// _p1 and _p2 = positions
private ["_p1", "_p2", "_curnum", "_dist", "_radius", "_dir", "_dirn", "_x1", "_y1"];
PARAMS_3(_p1,_p2,_curnum);
_dist = _p1 distance _p2;
_radius = _dist / 2;
_dir = [_p1, _p2] call FUNC(DirTo);
_dirn = _dir + 180;
_x1 = (_p1 select 0) - (_radius * sin _dirn);
_y1 = (_p1 select 1) - (_radius * cos _dirn);
//[QGVAR(epl1_) + str(_curnum),_p1,"ICON","ColorBlack",[0.5,0.5],"",0,"mil_dot"] call FUNC(CreateMarkerLocal);
//[QGVAR(epl2_) + str(_curnum),_p2,"ICON","ColorBlack",[0.5,0.5],"",0,"mil_dot"] call FUNC(CreateMarkerLocal);
[QGVAR(aline) + str(_curnum),[_x1, _y1],"RECTANGLE","ColorBlack",[_dist / 2, 10],"",_dir + 90,"mil_dot"] call FUNC(CreateMarkerLocal);
__INC(_curnum);
_curnum